

*first the data on labels coded from the partymanifesto dataset
*this data associates every party in the Consolidation of Democracy with a party family from CMP
import excel "cee_survey/parties_label_cee.xlsx", sheet("Sheet1") firstrow clear
sort country vote_choice
save parties_label_cee.dta, replace

*Bring in the Survey
use "cee_survey/ZA4054.dta", clear

keep V2 V3 V4 V44 V308-V321

*get rid of west germany, east germany, kraysnodar, belarus
*these are countries that are either not Eastern or do not meet the requirements (footnote 6 in paper)
drop if V3==5|V3==6

*gen a variable adding all party variables
egen vote_choice=rowtotal(V308-V321)

**drop non values
drop if vote_choice>50
drop if vote_choice==0


*gen a string variable of country
decode V3, gen(country)
sort country vote_choice
merge country vote_choice using parties_label_cee.dta

*drop parties that have no answers in the survey dataset
drop if _merge==2

*drop respondents with no l-r placement
drop if V44==.

keep V2 country F V44

gen party_fam2=real(F)
drop if party_fam2==.
	*with the line above I get rid of Belarus and Kraysnodar

*gen party family as they are in the R code
gen voteint=.
replace voteint=150 if party_fam2==20
replace voteint=250 if party_fam2==30
replace voteint=350 if party_fam2==40
replace voteint=450 if party_fam2==50
replace voteint=550 if party_fam2==60
replace voteint=650 if party_fam2==70
replace voteint=850 if party_fam2==10

rename V2 id
rename V44 lrs
keep id lrs voteint 

saveold "datasource/cee_survey_short.dta", version(12) replace
